<?php

$rows = array( array('需求单号:', $summary['demands']) );

$tmp  = array('材料编号','材料名称','品牌','规格','单位','数量');
foreach($suppliers as $s){
	$tmp[] = "{$s['name']}-单价";
	$tmp[] = "{$s['name']}-金额";
}
$tmp[] = '供应商';
$tmp[] = '备注';
$rows[] = $tmp;

foreach($stuffs as $s){
	$tmp = array($s['sno'], $s['name'], $s['brand'], $s['specific'], $s['unit'], $s['amount']);
	foreach($suppliers as $sp){
		$tmp[] = $s['suppliers'][$sp['id']]['quote'];
		$tmp[] = $s['suppliers'][$sp['id']]['quote'] * $s['amount'];
	}
	if($s['supplier_id']){
		$tmp[] = $all_suppliers[$s['supplier_id']]['name'];
		$tmp[] = $s['remark'];
	}
	else{
		$tmp[] = '';
		$tmp[] = '';
	}
	$rows[] = $tmp;
}

Exporter::csv($rows, "供应商价格对比表-".fetch_a_int('id'));

?>